package com.atguigu.flink03;

import org.apache.flink.streaming.api.datastream.DataStreamSource;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;

/**
 * @author Felix
 * @date 2024/2/20
 * 该案例演示了从集合中读取数据
 */
public class Flink03_Source_Collection {
    public static void main(String[] args) throws Exception {
        //TODO 1.指定流处理环境
        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
        //TODO 2.从集合中读取数据
        //DataStreamSource<Integer> colDS = env.fromCollection(Arrays.asList(1, 2, 3, 4));
        DataStreamSource<Integer> colDS = env.fromElements(1, 2, 3, 4);
        colDS.print();

        env.execute();
    }
}
